
package tests.laurens.cajo;

import gnu.cajo.Cajo;


public class Server {

	public static class Test { // remotely callable classes must be public
		// though not necessarily declared in the same class
		private final String greeting;
		// no silly requirement to have no-arg constructors
		public Test(String greeting) {
			this.greeting = greeting;
		}
		// all public methods, instance or static, will be remotely callable
		public String foo(Object bar, int count) {
			System.out.println("foo called w/ " + bar + ' ' + count + " count");
			return greeting;
		}
		public Boolean bar(int count) {
			System.out.println("bar called w/ " + count + " count");
			return Boolean.TRUE;
		}
		public boolean baz() {
			System.out.println("baz called");
			return true;
		}
		public String other() { // functionality not needed by the test client
			return "This is extra stuff";
		}
	} // arguments and return objects can be custom or common to server and client

	public static void main(String args[]) throws Exception { // unit test
		Cajo cajo = new Cajo(0, "", "");
		System.out.println("Server running");
		cajo.export(new Test("Thanks"));
	}
}
